<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>Using dbmigrate with Grails</title>
</head>
<body>
<h1>Using dbmigrate with Grails</h1>

<h2>Installation</h2>

<p>The best way to install it is to use</p>
<pre> grails install-plugin grails-dbmigrate-0.1.zip</pre>
<p>to add the functionality to your application.</p>
<p>The two scripts can now be executed like this:</p>
<pre> grails create-migration</pre>
<p>First this migrates your database to ensure that it is itself up to date. Then it will look at your database (using
    your datasource configuration) and determines the current version. It
    then creates a new
</p>
<pre> migratefromN.sql</pre>
<p>script within the grails-app/migrations/[database name] directory. You should then edit that file in order to do your
change.</p>

<p>If you have no db_version table in the database you should create that table as the first order of business in the
    initial migration:</p>
<pre> CREATE TABLE db_version (version integer NOT NULL)</pre>
<p>Since even that syntax might be database specific I do not have it automatically create it for you.</p>
<pre> grails migrate</pre>
<p>This will attempt to automatically advance the configured database (looking at GRAILS_ENV and DataSource.groovy) to
    the most recent version available.</p>
</body>
</html>